package com.hj.chartdemo.chart;

import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.github.mikephil.charting.formatter.IValueFormatter;
import com.github.mikephil.charting.utils.ViewPortHandler;

import java.text.DecimalFormat;

/** Created by philipp on 02/06/16. */
public class HBarAxisValueFormatter implements IValueFormatter, IAxisValueFormatter {
  private final DecimalFormat mFormat = new DecimalFormat("###,###,###");

//  HBarAxisValueFormatter() {
//    mFormat = new DecimalFormat("###,###,###");
//  }

  // data
  @Override
  public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
//    return entry.getData() + " "+ (int)Math.abs(value);
    return mFormat.format(Math.abs(value));
  }

  // YAxis
  @Override
  public String getFormattedValue(float value, AxisBase axis) {
    return Math.abs(value)+ "";
  }

}

